<?php
$this->layout()->disableLayout();
switch ($this->type) {
	case "javascript":
?>
// Загружаем все необходимые скрипты
dojo.xhrGet({
		url: '/cms/scripts/Popup.js',
		handleAs: "javascript",
		sync: true
	});
dojo.xhrGet({
		url: '/cms/scripts/tabWidget.js',
		handleAs: "javascript",
		sync: true
	});


new mfTabWidget('adminAddTabs');

dojo.query('#addAdminCloseBtn, #addAdminBackTab')
	.onclick(function () {
			dojo.destroy('addAdminBox');
			dojo.query('#adminListBox').removeClass('isHidden');
			dojo.destroy(addAdminStylesheet);
		});
		
dojo.query('#addAdminSubmitBtn').onclick(
	function () {
		dojo.xhrPost({
				url: '/cms/administrator/add/type/save',
				load: function(response, ioArgs) {
						if (response['ok']=='1') {
							dojo.destroy('addAdminBox');
							dojo.query('#adminListBox').removeClass('isHidden');
							dojo.destroy(addAdminStylesheet);
							dojo.publish('onsaveok',[]);
						} else {
							for (var inp in response) {
								if (!dojo.byId(inp)) {
									break;
								}
								dojo.query(dojo.byId(inp))
									.addClass('modalInputError')
									.connect('onkeydown', function () {
											dojo.query(this).removeClass('modalInputError');
										});
								var exclamTrigger = dojo.create('img',{className:'errorBulb isActive',src: '/cms/images/exclamation_frame.png'},inp,'after');
								var tip = dojo.create('div',{className:'splashHint',innerHTML:response[inp]},exclamTrigger,'after');
								new PopupArea(exclamTrigger,tip,PopupAreaAdaptors.mouseOverSplashUnderTrigger);
								var emptyOldPopups = function (trigger,tiptip) {
										dojo.query('#addAdminSubmitBtn').onclick(
											function () {
												dojo.destroy(trigger);
												dojo.destroy(tiptip);
											});
									};
								emptyOldPopups(exclamTrigger,tip);
							} 
						}
					},
				error: function (response, ioArgs){
						alert("An error occurred, with response: " + response);
						return response;
					},
				form: 'addAdminForm',
				handleAs:"json",
				sunc: true
			});
		
	});
	
var addAdminStylesheet = dojo.create('link',{rel:'stylesheet',type:'text/css',href:'/cms/administrator/add/type/css/style.css'},dojo.query('head')[0]);
<?php 
		break;
	case "css":
?>
.modalContent .labelBox {
	width: 150px;
}
.modalContent .inputBox input, .modalContent .inputBox textarea {
	width: 300px;
}
.modalControls .modalControlsBox {
	padding-left: 160px;
}

.modalContent h1 {
	padding-left: 154px;
}
.modalContent .splashHint {
	max-width: 350px;
}
.modalContent .errorBulb {
	padding-left: 4px;
}
<?php 
		break;
	case "html":
?>
<ul id="adminAddTabs">
  <li><a class="isActive back" id="addAdminBackTab">Назад к списку администраторов</a></li>
  <li class="active"><a>Добавление администратора</a></li>
</ul>
<div class="modalContent">
  <h1>Добавление администратора</h1>
  <form id="addAdminForm">
    <div class="labelBox">Логин:</div>
    <div class="inputBox">
    <input name="login" type="text" class="modalInput" id="login" /> 
    </div>
    <div class="antifloat"></div>
    <div class="labelBox">Имя:</div>
    <div class="inputBox">
    <input name="name" type="text" class="modalInput" id="name" /></div>
    <div class="antifloat"></div>
    <div class="labelGroupBox">
      <div class="labelBox">Пароль:</div>
      <div class="inputBox">
        <input name="pass" type="password" class="modalInput" id="pass" />
        </div>
      <div class="antifloat"></div>
      <div class="labelBox">Подтверждение:</div>
      <div class="inputBox">
        <input name="confirm" type="password" class="modalInput" id="confirm" />
        </div>
      <div class="antifloat"></div>
    </div>
    <div class="labelBox">Примечание:</div>
    <div class="inputBox">
      <textarea name="summary" rows="5" class="modalInput" id="summary"></textarea>
    </div>
    <div class="antifloat"></div>
  </form>
</div>
<div class="modalControls">
  <div class="controllGrad"></div>
  <div class="modalControlsBox">
    <input type="button" class="okButton" value="Сохранить" id="addAdminSubmitBtn" />
    <input type="button" class="okButton" value="Закрыть" id="addAdminCloseBtn" />
  </div>
</div>

<?php 	
		break;
	
	default:
?>

<?php 
	break;
}
?>